/**
 * Created by Administrator on 2017/7/14 0014.
 */
$(function($) {
    var zoomLevel = 12;
    var zoomLevel2 = 16;
    var map = new BMap.Map("myMap",{enableMapClick:false});
    var countryMap = new BMap.Map("countryMap",{enableMapClick:false});
    window.map = map;
    map.enableDragging();
    map.disable3DBuilding();
    map.disableDoubleClickZoom();
    map.setMapStyle({style:'midnight'});
    map.centerAndZoom(new BMap.Point(118.272143,37.138386),zoomLevel);

    /* 各村地图 */
    var myStyleJson = [
        {
            "featureType": "water",
            "elementType": "all",
            "stylers": {
                "color": "#021019"
            }
        },
        {
            "featureType": "highway",
            "elementType": "geometry.fill",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "highway",
            "elementType": "geometry.stroke",
            "stylers": {
                "color": "#147a92"
            }
        },
        {
            "featureType": "arterial",
            "elementType": "geometry.fill",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "arterial",
            "elementType": "geometry.stroke",
            "stylers": {
                "color": "#0b3d51"
            }
        },
        {
            "featureType": "local",
            "elementType": "geometry",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "land",
            "elementType": "all",
            "stylers": {
                "color": "#08304b"
            }
        },
        {
            "featureType": "railway",
            "elementType": "geometry.fill",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "railway",
            "elementType": "geometry.stroke",
            "stylers": {
                "color": "#08304b"
            }
        },
        {
            "featureType": "subway",
            "elementType": "geometry",
            "stylers": {
                "lightness": -70
            }
        },
        {
            "featureType": "building",
            "elementType": "geometry.fill",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "all",
            "elementType": "labels.text.fill",
            "stylers": {
                "color": "#857f7f"
            }
        },
        {
            "featureType": "all",
            "elementType": "labels.text.stroke",
            "stylers": {
                "color": "#000000"
            }
        },
        {
            "featureType": "building",
            "elementType": "geometry",
            "stylers": {
                "color": "#022338"
            }
        },
        {
            "featureType": "green",
            "elementType": "geometry",
            "stylers": {
                "color": "#062032"
            }
        },
        {
            "featureType": "boundary",
            "elementType": "all",
            "stylers": {
                "color": "#1e1c1c"
            }
        },
        {
            "featureType": "background",
            "elementType": "all",
            "stylers": {
                "color": "#01264b"
            }
        }
    ];
    countryMap.enableDragging();
    countryMap.disable3DBuilding();
    countryMap.disableDoubleClickZoom();
    countryMap.setMapStyle({styleJson: myStyleJson });
    countryMap.centerAndZoom(new BMap.Point(118.272143,37.138386),zoomLevel2);

    //隐藏百度地图的版权信息
    setTimeout(function(){
        $(".anchorBL").hide();
    },1000);
    /* 添加行政区划 */
    function getBoundary(){
        var bdary = new BMap.Boundary();
        bdary.get("博兴县", function(rs){       //获取行政区域
            var count = rs.boundaries.length; //行政区域的点有多少个
            if (count === 0) {
                alert('未能获取当前输入行政区域');
                return ;
            }
            var pointArray = [];
            for (var i = 0; i < count; i++) {
                var ply = new BMap.Polygon(rs.boundaries[i], {strokeWeight: 3, strokeColor: "#fff",fillColor:'rgba(255,255,255,0.1)'}); //建立多边形覆盖物
                map.addOverlay(ply);  //添加覆盖物
                pointArray = pointArray.concat(ply.getPath());
            }
            // map.setViewport(pointArray);    //调整视野
            map.centerAndZoom(new BMap.Point(118.272143,37.138386),zoomLevel);
        });
    }
    setTimeout(function(){
        getBoundary();
    }, 2000);

    /* 中间地图打点 */
    var data = [
        [109.016119,34.173635],
        [108.930876,34.160781],
        [108.977707,34.143922],
        [108.946327,34.138524],
        [108.978034,34.137741],
        [109.006097,34.137396],
        [114.592622,38.076875],
        [108.960689,34.149481],
        [108.769101,34.016474],
        [108.964656,34.137668],
        [108.973224,34.145886],
        [109.047414,34.092842],
        [114.592622,38.076875],
        [109.013508,34.147326],
        [108.933419,34.143908],
        [108.993972,34.150681],
        [108.89877,34.149349],
        [108.88061,34.137643],
        [108.833336,34.151131],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [108.88821,34.174787],
        [108.901533,34.129099],
        [114.592622,38.076875],
        [108.849465,34.190438],
        [108.866753,34.08922],
        [108.843863,34.090895],
        [108.861522,33.926644],
        [108.82437,34.054266],
        [108.786403,33.812538],
        [108.858716,34.084301],
        [108.801833,34.060137],
        [108.878148,34.095955],
        [108.872959,34.083999],
        [108.8214,34.041779],
        [108.859684,33.914219],
        [108.852859,33.949703],
        [108.852347,33.970302],
        [108.803378,34.063757],
        [108.773137,34.232557],
        [108.85918,34.01605],
        [108.838861,33.994545],
        [108.847457,34.085646],
        [108.867957,34.059414],
        [108.853467,34.064529],
        [108.886028,34.074001],
        [108.854935,34.093847],
        [108.813925,34.05758],
        [108.845169,34.05601],
        [108.895665,33.974998],
        [108.847335,34.107262],
        [114.592622,38.076875],
        [108.853284,33.976679],
        [108.881252,33.962749],
        [108.877639,34.078808],
        [108.810483,34.055273],
        [108.80005,34.063426],
        [108.873242,34.096238],
        [108.813369,34.062241],
        [114.592622,38.076875],
        [108.843762,34.065908],
        [108.838039,34.0629],
        [108.836423,34.061877],
        [108.814225,34.065106],
        [108.879155,34.059449],
        [108.812476,34.044607],
        [108.860124,33.976892],
        [109.101184,34.028734],
        [114.592622,38.076875],
        [108.763252,34.225703],
        [109.086086,34.111253],
        [109.131499,34.070735],
        [108.892771,34.165],
        [109.126116,34.070958],
        [109.152405,34.074469],
        [109.127044,34.025359],
        [109.110711,34.087638],
        [114.635104,38.092359],
        [109.116874,34.062888],
        [109.116861,34.07432],
        [109.140684,34.082597],
        [109.084055,34.12518],
        [109.075642,34.119692],
        [108.803976,34.078638],
        [109.114375,34.030085],
        [109.11057,34.058083],
        [109.122764,34.051779],
        [109.108695,34.081468],
        [109.082591,34.098874],
        [109.095454,34.044416],
        [109.094329,34.047584],
        [109.133257,34.073936],
        [109.12262,34.072283],
        [109.124943,34.036537],
        [109.1507,34.07703],
        [109.092,34.028593],
        [109.140085,34.083516],
        [109.103407,34.087907],
        [109.112423,34.043954],
        [109.124196,34.041408],
        [109.130255,33.963584],
        [114.592622,38.076875],
        [109.139285,34.035433],
        [109.121156,34.087312],
        [109.132676,34.080671],
        [109.112509,34.096701],
        [109.124516,34.008603],
        [108.784387,34.068871],
        [108.792861,34.043119],
        [108.76036,33.895508],
        [108.773503,34.044152],
        [108.878148,34.095955],
        [108.759922,34.066507],
        [108.755858,34.060275],
        [108.783241,34.024979],
        [108.777518,34.018392],
        [108.791092,34.032891],
        [108.772959,34.061257],
        [108.782301,34.061696],
        [108.792381,34.04059],
        [108.766367,34.083029],
        [108.769101,34.016474],
        [108.776685,34.070652],
        [108.78798,34.00062],
        [108.7757,34.00933],
        [108.805284,34.040155],
        [108.905012,34.014668],
        [108.898045,34.06363],
        [108.937128,34.059545],
        [108.930875,34.06885],
        [108.749602,34.278971],
        [108.95152,34.03416],
        [108.935952,34.074467],
        [108.897923,34.05727],
        [108.89102,34.025656],
        [109.146858,34.081791],
        [108.902625,34.049162],
        [108.927329,34.024449],
        [108.935508,34.042292],
        [114.592622,38.076875],
        [108.951167,34.038994],
        [108.764889,34.20088],
        [108.907506,34.066279],
        [109.033422,34.04039],
        [109.030198,34.028128],
        [109.03633,34.052049],
        [108.78823,34.279061],
        [109.017315,34.042856],
        [109.015367,34.050202],
        [109.02055,34.032737],
        [109.01695,34.056448],
        [109.008284,34.042557],
        [109.020845,33.989493],
        [109.0087,34.037172],
        [109.013518,34.016669],
        [109.037693,34.027656],
        [109.038661,34.037683],
        [109.001328,34.049383],
        [109.018945,34.059143],
        [109.012498,34.049102],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [109.014938,34.008936],
        [109.00763,33.982446],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [108.772909,34.154381],
        [108.787056,34.152072],
        [108.792109,34.173331],
        [108.794478,34.165166],
        [114.592622,38.076875],
        [108.788483,34.171779],
        [114.592622,38.076875],
        [108.806691,34.175503],
        [108.782403,34.165956],
        [109.039093,34.098244],
        [109.060155,34.090194],
        [108.999401,34.126866],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [108.992717,34.10753],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [109.026678,34.104718],
        [109.013468,34.084727],
        [108.994365,34.106132],
        [109.021437,34.110331],
        [108.984519,34.115257],
        [109.030353,34.099523],
        [109.047414,34.092842],
        [108.993475,34.130176],
        [109.006812,34.11887],
        [108.966584,34.126762],
        [114.592622,38.076875],
        [108.989592,34.109831],
        [108.975848,34.120864],
        [108.990014,34.110974],
        [109.019259,34.080005],
        [109.053731,34.091934],
        [109.060822,34.140565],
        [109.04777,34.151223],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [109.034778,34.129027],
        [109.053425,34.109603],
        [109.042408,34.112865],
        [109.036852,34.164774],
        [109.058695,34.126553],
        [109.006591,34.157022],
        [108.934236,34.101725],
        [109.090213,34.153559],
        [109.056946,34.135899],
        [109.039025,34.121829],
        [109.036863,34.150408],
        [108.786723,34.134247],
        [108.855459,34.136134],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [108.827428,34.131202],
        [108.774179,34.123876],
        [108.772683,34.125622],
        [114.592622,38.076875],
        [108.875514,34.115813],
        [108.927024,34.091255],
        [108.914811,34.109869],
        [108.892902,34.102788],
        [114.547229,38.100848],
        [108.934561,34.086347],
        [108.902745,34.102175],
        [108.878869,34.105955],
        [108.925203,34.081926],
        [108.916397,34.107651],
        [108.883425,34.113051],
        [108.902326,34.106047],
        [108.892307,34.088031],
        [114.592622,38.076875],
        [108.921525,34.088289],
        [108.899263,34.110833],
        [108.920952,34.082721],
        [108.991176,34.090481],
        [108.97971,34.074097],
        [108.985991,34.066605],
        [114.592622,38.076875],
        [108.952451,34.107308],
        [108.964492,34.10146],
        [108.929704,34.121851],
        [108.941733,34.097132],
        [108.9593,34.104689],
        [108.960863,34.059267],
        [108.981462,34.067376],
        [108.99974,34.063639],
        [108.994942,34.086537],
        [108.961693,34.088788],
        [108.962855,34.070107],
        [108.976248,34.083204],
        [108.990287,34.085334],
        [108.963492,34.079141],
        [108.928727,34.106135],
        [108.934236,34.101725],
        [108.965444,34.105862],
        [108.979665,34.056364],
        [108.984615,34.091592],
        [108.944725,34.118512],
        [109.119431,34.007375],
        [108.993962,34.069488],
        [109.09613,34.125644],
        [109.113481,34.125417],
        [109.10838,34.143925],
        [109.113943,34.139726],
        [114.592622,38.076875],
        [109.13415,34.111566],
        [109.126647,34.150923],
        [109.106618,34.111217],
        [109.117333,34.158502],
        [109.140664,34.126071],
        [109.131525,34.132353],
        [109.127903,34.104102],
        [109.097284,34.145726],
        [109.097352,34.148254],
        [109.106878,34.160063],
        [109.114909,34.133572],
        [109.115044,34.133869],
        [114.592622,38.076875],
        [109.11857,34.119761],
        [109.113392,34.113019],
        [109.116434,34.102606],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [109.115867,34.127269],
        [109.131631,34.118774],
        [109.091783,34.179618],
        [108.934236,34.101725],
        [114.592622,38.076875],
        [109.132353,34.147889],
        [109.116928,34.124867],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [114.592622,38.076875],
        [109.085951,34.066322],
        [109.105397,34.062384],
        [109.072943,34.058643],
        [109.042778,34.056928],
        [109.082857,34.029391],
        [109.053073,34.03167],
        [109.091302,34.077024],
        [114.592622,38.076875],
        [109.04798,34.041584],
        [109.079645,34.053871],
        [109.043219,34.046435],
        [109.087797,34.074623],
        [109.065493,34.037531],
        [109.083295,34.044947],
        [109.067937,34.034466],
        [109.038109,34.068076],
        [109.057236,34.05177],
        [108.964656,34.137668],
        [109.056507,34.039996],
        [109.074336,34.079945],
        [109.070263,34.082195],
        [109.068243,34.083598],
        [109.076491,34.079755],
        [109.179881,34.111624],
        [109.067685,34.061946],
        [109.039663,34.079505],
        [109.056013,34.054486],
        [109.081809,34.002753],
        [109.061488,34.025202],
        [109.060799,34.026734],
        [114.592622,38.076875],
        [109.076155,34.023992],
        [109.157338,34.062118],
        [109.157321,34.067938],
        [109.175758,34.032185],
        [109.147721,34.033754],
        [109.166055,34.051743],
        [109.14184,34.059697],
        [109.166163,34.014784],
        [109.157965,34.035796],
        [109.178828,34.014763],
        [109.147821,34.03712],
        [109.163764,34.057361],
        [109.14127,34.051669],
        [109.164604,34.031906],
        [109.150301,34.024509],
        [109.173911,34.040122],
        [109.176998,34.025579],
        [109.15324,34.044857],
        [109.152838,34.050804],
        [108.996001,34.045723],
        [108.962728,34.034262],
        [108.960063,33.994575],
        [109.002116,34.029655],
        [114.618762,38.049811],
        [108.93418,33.96345],
        [108.938941,33.981818],
        [108.960987,34.043259],
        [108.988533,34.045657],
        [108.959456,34.031971],
        [108.910697,33.96333],
        [108.996003,34.02008],
        [108.997557,34.034469],
        [108.974667,34.026727],
        [108.786519,34.082813],
        [108.784294,34.088137],
        [108.833654,34.102911],
        [108.779731,34.102809],
        [108.791726,34.106481],
        [108.803976,34.078638],
        [108.814754,34.080358],
        [108.786722,34.085654],
        [108.816276,34.091158],
        [108.809052,34.078153],
        [109.082591,34.098874],
        [108.789664,34.078616],
        [108.782524,34.272639],
        [108.815986,34.100625],
        [108.783299,34.084048],
        [108.752764,34.142014],
        [108.722701,34.180234],
        [114.592622,38.076875],
        [108.711601,34.187828],
        [108.740402,34.159539],
        [108.71907,34.163408],
        [114.592622,38.076875],
        [108.737549,34.164487],
        [114.592622,38.076875],
        [108.701236,34.187205],
        [108.718836,34.176225],
        [108.726067,34.136919],
        [108.748934,34.129993],
        [108.7497,34.150892],
        [108.752214,34.126388],
        [108.733543,34.15836],
        [108.71369,34.178571],
        [108.742314,34.153038],
        [108.737299,34.140756],
        [109.15905,34.112736],
        [109.182187,34.107692],
        [109.202169,34.119215],
        [114.592622,38.076875],
        [109.176686,34.124808],
        [114.592622,38.076875],
        [109.187144,34.11075],
        [109.151937,34.119861],
        [109.183492,34.111993],
        [109.179881,34.111624],
        [114.592622,38.076875],
        [109.193938,34.120081],
        [109.127574,34.072092],
        [109.175086,34.110411],
        [109.1673,34.169282],
        [109.13664,34.17718],
        [109.178533,34.141906],
        [114.592622,38.076875],
        [109.157762,34.148896],
        [109.134449,34.160612],
        [109.163506,34.173707],
        [114.618762,38.049811],
        [109.165887,34.153114],
        [109.148163,34.172331],
        [109.160658,34.167552],
        [114.592622,38.076875],
        [109.121779,34.172255],
        [109.149264,34.153353],
        [114.592622,38.076875],
        [109.12731,34.16331],
        [109.146183,34.15606]
    ];
    var data4 = [
        [108.866586,34.105817],
        [108.871764,33.998126],
        [108.784681,34.204685],
        [109.129619,34.031432],
        [109.121756,33.999678],
        [108.921327,34.044031],
        [108.939481,34.040237],
        [109.02832,34.016997],
        [109.010141,34.009491],
        [109.057476,34.176161],
        [109.069527,34.170482],
        [109.071898,34.168092],
        [109.069141,34.165267],
        [109.06073,34.184507],
        [109.079202,34.15976],
        [114.592622,38.076875],
        [108.990415,34.071838],
        [108.982041,34.052648],
        [109.159081,34.135173],
        [109.137729,34.107532],
        [109.048442,34.026095],
        [109.145988,34.006208],
        [109.157568,34.016785],
        [109.193855,33.922645],
        [109.187452,33.987404],
        [109.14476,34.027584],
        [109.191469,33.937336],
        [108.969811,33.971868],
        [108.936559,33.955158],
        [108.942341,33.940463],
        [109.205707,34.113873],
        [109.056946,34.135899]
    ]
    //普通标注点方法
    var drawPoints = function(data,color,size){
        var points = [];
        for (var i = 0; i < data.length; i++) {
            points.push(new BMap.Point(data[i][0], data[i][1]));
        }
        var options = {
            size: size,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: color
        }
        var pointCollection = new BMap.PointCollection(points, options);
        map.addOverlay(pointCollection);  // 添加Overlay
        pointCollection.addEventListener('click', countryMapEvent);
    }
    drawPoints(data,'rgba(9,212,255,1)', (300,300));
    drawPoints(data4,'rgba(255,210,0,1)',BMAP_POINT_SIZE_BIG);
    //点击大地图将经纬度传给小地图
    function countryMapEvent(e) {
        $('.mapRight').animate({right:'0.104vw'});
        $('.ifShowMap').fadeIn();
        $('.ifShowMap').attr('data-flag','show').text('>');
        countryMap.centerAndZoom(new BMap.Point(e.point.lng,e.point.lat),zoomLevel2);
        countryMap.clearOverlays();
        // 随机向地图添加10个标注
        var bounds = countryMap.getBounds();
        var sw = bounds.getSouthWest();
        var ne = bounds.getNorthEast();
        var lngSpan = Math.abs(sw.lng - ne.lng);
        var latSpan = Math.abs(ne.lat - sw.lat);
        var countryPoints = [];
        var countryPoints2 = [];
        var countryPoints3 = [];
        var countryPoints4 = [];
        var countryPoints5 = [];
        for (var i = 0; i < 3; i ++) {
            countryPoints.push(new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.8), ne.lat - latSpan * (Math.random() * 0.8)));
        }
        for (var i = 0; i < 2; i ++) {
            countryPoints2.push(new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.8), ne.lat - latSpan * (Math.random() * 0.8)));
        }
        for (var i = 0; i < 2; i ++) {
            countryPoints3.push(new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.8), ne.lat - latSpan * (Math.random() * 0.8)));
        }
        for (var i = 0; i < 2; i ++) {
            countryPoints4.push(new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.8), ne.lat - latSpan * (Math.random() * 0.8)));
        }
        countryPoints5.push(new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.8), ne.lat - latSpan * (Math.random() * 0.8)));
        var options = {
            size:  BMAP_POINT_SIZE_BIG,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#09d4ff'
        }
        var options2 = {
            size:  BMAP_POINT_SIZE_BIG,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#7cf102'
        }
        var options3 = {
            size:  BMAP_POINT_SIZE_BIG,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#ffd200'
        }
        var options4 = {
            size: BMAP_POINT_SIZE_BIG,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#ff787a'
        }
        var options5 = {
            size:  BMAP_POINT_SIZE_BIG,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#fefeff'
        }
        var countryPointCollection = new BMap.PointCollection(countryPoints, options);  // 初始化PointCollection       低保贫困户
        var countryPointCollection2 = new BMap.PointCollection(countryPoints2, options2);  // 初始化PointCollection     五保贫困户
        var countryPointCollection3 = new BMap.PointCollection(countryPoints3, options3);  // 初始化PointCollection     一般贫困户
        var countryPointCollection4 = new BMap.PointCollection(countryPoints4, options4);  // 初始化PointCollection     党员户
        var countryPointCollection5 = new BMap.PointCollection(countryPoints5, options5);  // 初始化PointCollection     已脱贫
        countryMap.addOverlay(countryPointCollection);
        countryMap.addOverlay(countryPointCollection2);
        countryMap.addOverlay(countryPointCollection3);
        countryMap.addOverlay(countryPointCollection4);
        countryMap.addOverlay(countryPointCollection5);
        countryPointCollection.addEventListener('click', rightHouseMsg);
        countryPointCollection2.addEventListener('click', rightHouseMsg);
        countryPointCollection3.addEventListener('click', rightHouseMsg);
        countryPointCollection4.addEventListener('click', rightHouseMsg);
        countryPointCollection5.addEventListener('click', rightHouseMsg);
        // var drawPoint = function(data,color){
        //     var points2 = [];
        //     for (var t = 0; t < data.length; t++) {
        //         points2.push(new BMap.Point(data[t][0], data[t][1]));
        //     }
        //     // points2.push(new BMap.Point(e.point.lng, e.point.lat));
        //     var options2 = {
        //         size: BMAP_POINT_SIZE_SMALL,
        //         shape: BMAP_POINT_SHAPE_CIRCLE,
        //         color: color
        //     }
        //     var countryPointCollection = new BMap.PointCollection(points2, options2);
        //     countryMap.addOverlay(countryPointCollection);  // 添加Overlay
        // }
        // drawPoint(data1,'rgba(124,241,2,1)');
        // drawPoint(data2,'rgba(180,66,255,1)');
        // drawPoint(data3,'rgba(255,210,0,1)');
    }

    /* 贫困户信息切换 */
    var swiperMsg = new Swiper('.swiper-msg', {
        pagination: '.swiperMsgPage',
        paginationClickable: true,
        autoplay: 6 * 1000,
        autoplayDisableOnInteraction: false,
        observer:true,
        observeParents:true,
    });
    $('.swiper-msg').mouseenter(function(){
        swiperMsg.stopAutoplay();
    }).mouseleave(function(){
        swiperMsg.startAutoplay();
    })
    var imgs = ['1.jpg','2.jpg','3.jpg','4.jpg'];
    var leaderImgs = ['leader01.jpg','leader02.jpg','leader03.jpg','leader04.jpg'];
    var current = 0;
    function rightHouseMsg(e){
        swiperMsg.slideTo(0, 200, false);

        /* 领导和贫困户照片随机切换 */
        $('.familyImg .swiper-slide img').attr('src','images/'+ imgs[current]);
        $('.leaderPhoto img').attr('src','images/'+ leaderImgs[current]);
        current++;
        if(current > 3) current =0;

    }

    /* 各贫困村名字轮播 */
    var timer = 2000;
    var itemIndex = 0;
    setTimeout(function(){
        setInterval(function(){
            for(var i = 0; i < 32; i++){
                if(itemIndex == i){
                    infos[i][0].show();
                    infos[i][1].show();
                }else{
                    infos[i][0].hide();
                    infos[i][1].hide();
                }
            }
            itemIndex++;
            if(itemIndex > 31) itemIndex = 0;
        }, timer);
    }, timer * 5);
    // 弹出层覆盖物
    function ComplexCustomOverlay(point,title){
        this._point = point;
        this._title = title;
    }
    ComplexCustomOverlay.prototype = new BMap.Overlay();
    ComplexCustomOverlay.prototype.initialize = function(map){
        this._map = map;
        var div = this._div = document.createElement("div");
        $(div).addClass('tip');
        div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
        $(div).append('<div class="tip">' +
            '<h2>'+this._title+'</h2>' +
            '</div>');
        map.getPanes().labelPane.appendChild(div);
        return div;
    }
    ComplexCustomOverlay.prototype.draw = function(){
        var map = this._map;
        var pixel = map.pointToOverlayPixel(this._point);
        this._div.style.left = pixel.x - 90 + "px";
        this._div.style.top  = pixel.y - 30 + "px";
    }
    // 水滴覆盖物
    function WaterDropOverlay(point){
        this._point = point;
    }
    WaterDropOverlay.prototype = new BMap.Overlay();
    WaterDropOverlay.prototype.initialize = function(map){
        this._map = map;
        var div = this._div = document.createElement("div");
        $(div).addClass('water');
        div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
        $(div).append('<img src="images/yellowPos.png"/>');
        map.getPanes().labelPane.appendChild(div);
        return div;
    }
    WaterDropOverlay.prototype.draw = function(){
        var map = this._map;
        var pixel = map.pointToOverlayPixel(this._point);
        this._div.style.left = pixel.x - 13 + "px";
        this._div.style.top  = pixel.y - 42 + "px";
    }
    var flag = 0;
    var myCompOverlay = '';
    var waterDropOverlay = '';
    //弹出层移动的点
    var waterdata = [
        [108.866586,34.105817,'***村'],
        [108.871764,33.998126,'***村'],
        [108.784681,34.204685,'***村'],
        [109.129619,34.031432,'***村'],
        [109.121756,33.999678,'***村'],
        [108.921327,34.044031,'***村'],
        [108.939481,34.040237,'***村'],
        [109.02832,34.016997,'***村'],
        [109.010141,34.009491,'***村'],
        [109.057476,34.176161,'***村'],
        [109.069527,34.170482,'***村'],
        [109.071898,34.168092,'***村'],
        [109.069141,34.165267,'***村'],
        [109.06073,34.184507,'***村'],
        [109.079202,34.15976,'***村'],
        [114.592622,38.076875,'***村'],
        [108.990415,34.071838,'***村'],
        [108.982041,34.052648,'***村'],
        [109.159081,34.135173,'***村'],
        [109.137729,34.107532,'***村'],
        [109.048442,34.026095,'***村'],
        [109.145988,34.006208,'***村'],
        [109.157568,34.016785,'***村'],
        [109.193855,33.922645,'***村'],
        [109.187452,33.987404,'***村'],
        [109.14476,34.027584,'***村'],
        [109.191469,33.937336,'***村'],
        [108.969811,33.971868,'***村'],
        [108.936559,33.955158,'***村'],
        [108.942341,33.940463,'***村'],
        [109.205707,34.113873,'***村'],
        [109.056946,34.135899,'***村']
    ];
    var waterPoints = [];
    var infos = [];
    for (var flag = 0; flag < waterdata.length; flag++) {
        //waterPoints.push();
        var wp = new BMap.Point(waterdata[flag][0], waterdata[flag][1]);
        myCompOverlay = new ComplexCustomOverlay(wp, waterdata[flag][2]);
        waterDropOverlay = new WaterDropOverlay(wp);
        map.addOverlay(myCompOverlay);
        map.addOverlay(waterDropOverlay);
        myCompOverlay.hide();
        waterDropOverlay.hide();
        infos.push([myCompOverlay, waterDropOverlay]);
    }
});